home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / pleas / ole / visio / network / vismouse.bas < prev    next >
Encoding:
BASIC Source File  |  1994-05-18  |  3.1 KB  |  90 lines

  1. '------------------------------------------------------------------------------
  2. '------------------------------------------------------------------------------
  3. '--
  4. '--                           Visio Mouse Utilities
  5. '--                       (C)1993 Shapeware Corporation
  6. '--
  7. '--   File Name : vismouse.bas
  8. '--
  9. '-- Description :
  10. '--
  11. '------------------------------------------------------------------------------
  12. '------------------------------------------------------------------------------
  13.  
  14. 'This file contains sample code for using Visual Basic and OLE 2.0 to
  15. 'automatically create a Visio network diagram from a Microsoft Access
  16. 'database.
  17. '
  18. 'IMPORTANT:  NETVB.ZIP is ONLY a sample, not a released product.  It was
  19. 'not extensively tested, and has no guarantee.  In addition, we do not provide
  20. 'documentation or support for this file.
  21.  
  22. Option Explicit
  23.  
  24. '--
  25. '-- SetHourGlass action constants
  26. '--
  27.  
  28. Global Const MP_WAIT = 1
  29. Global Const MP_NORMAL = 2
  30. Global Const MP_RESTORE = 3
  31.  
  32. Sub BeginWaitPointer ()
  33. '----------------------------------------
  34. '--- BeginWaitPointer -------------------
  35. '--
  36. '--   Use this procedure in conjunction with EndWaitPointer to toggle the mouse
  37. '-- pointer between an hourglass, wait mode, and a regular pointer.
  38. '--
  39.  
  40.     Screen.MousePointer = 11                    '-- Set To Hourglass Pointer
  41. End Sub
  42.  
  43. Sub EndWaitPointer ()
  44. '----------------------------------------
  45. '--- EndWaitPointer ---------------------
  46. '--
  47. '--   Use this procedure in conjunction with BeginWaitPointer to toggle the mouse
  48. '-- pointer between an hourglass, wait mode, and a regular pointer.
  49. '--
  50.  
  51.     Screen.MousePointer = 0                     '-- Set To Default Mouse Pointer
  52. End Sub
  53.  
  54. Sub SetMousePointer (iType As Integer)
  55. '----------------------------------------
  56. '--- SetMousePointer --------------------
  57. '--
  58. '--   Manages multiple requests for the hour glass pointer.  Passing MP_WAIT
  59. '-- not only changes the pointer to an hourglass, it increments the count of
  60. '-- requests for it.  MP_NORMAL will decrement it and only when it returns
  61. '-- to zero does the cursor change back to it's default pointer.  Multiple
  62. '-- procedures can ask for an hourglass this way without overrunning each other.
  63. '--
  64. '-- Parameters : iType - MP_WAIT     Changes mouse pointer to hourglass if not
  65. '--                                  already.
  66. '--                      MP_NORMAL   Decrements the hourglass count and, if 0,
  67. '--                                  restores the pointer to it's default.
  68. '--                      MP_RESTORE  Clears the hourglass count and restores
  69. '--                                  the pointer to it's default.
  70. '--
  71.  
  72.     Static iWaitCount As Integer
  73.  
  74.     Select Case iType
  75.         Case MP_WAIT
  76.             iWaitCount = iWaitCount + 1
  77.             Screen.MousePointer = 11
  78.         Case MP_NORMAL
  79.             If iWaitCount > 0 Then
  80.                 iWaitCount = iWaitCount - 1
  81.  
  82.                 If iWaitCount = 0 Then Screen.MousePointer = 0
  83.             End If
  84.         Case MP_RESTORE
  85.             iWaitCount = 0
  86.             Screen.MousePointer = 0
  87.     End Select
  88. End Sub
  89.  
  90.